import request from '@/utils/request';
import type { User, LoginData } from '@/types/user';

/**
 * 登录
 * @param data 登录信息
 */
export const loginApi = (data: LoginData): Promise<{ token: string }> => {
  return request({
    url: '/auth/login',
    method: 'POST',
    data,
  });
};

/**
 * 获取用户信息
 */
export const getUserInfoApi = (): Promise<User> => {
  return request({
    url: '/user/info',
    method: 'GET',
  });
};